<?php

include_once("../../commonFunctions.php");
$store = new Store($_SESSION['storeAbbrev']);
$dealer = new Dealer($_SESSION['dealerCode']);

if ($_GET['ttid'] == 'selectOne') {
    return '';
}
$tt = new TT($_GET['ttid']);
echo '<p class="fullwidth">Trouble Ticket Status Change History</p>';
echo "<table class=\"maintable\">";
echo "<tr>
        <td class=\"tableheader\">Modified By</td>
        <td class=\"tableheader\">DateTime Modified</td>
        <td class=\"tableheader\">Notes</td>
        <td class=\"tableheader\">Status</td>
        </tr>";
for ($i = 0; $i < sizeof($tt->statusArr); $i++) {
    echo '<tr>';
    echo '<td>' . $tt->statusArr[$i]->modifiedBy . '</td>';
    echo '<td>' . $tt->statusArr[$i]->dateTimeChange . '</td>';
    echo '<td>' . $tt->statusArr[$i]->notes . '</td>';
    echo '<td>' . $tt->statusArr[$i]->status . '</td>';
    echo '</tr>';
}
echo '</table>';

if ($dealer->isMA || $dealer->isSuperMA) {
    echo "<form action='updateStatus.php' method='get' >";
    echo '<input type="submit" value="Update The Status To ' . tts_getNextStatus($tt->currentStatus) . '"class="submit"/>';
    echo "</form>";
}
?>
